Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cdc): amortize snapshot read to multiple barriers #16349

Merged
merged 13 commits into from
Apr 26, 2024

Conversation

StrikeW
Copy link
Contributor

@StrikeW StrikeW commented Apr 17, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

We ensure to poll the snapshot stream at least once in each epoch previously, which may cause barrier pile up in some scenario (#15812)

This PR implement the RFC to allow reconstruct a new snapshot stream in each snapshot_interval barriers, trying to mitigate the barrier pile up problem.

  • Add snapshot_interval to configure the barrier interval to start a new snapshot
  • Add snapshot_read_full_table to read all historical data in batches to simplify main logic
  • Move the consumption of buffered events outside the backfill loop

follow-up: #16426

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@StrikeW StrikeW changed the title feat(cdc): amortize snapshot read to multiple barriers feat(cdc): amortize snapshot read to multiple barriers (WIP) Apr 17, 2024
@StrikeW StrikeW changed the title feat(cdc): amortize snapshot read to multiple barriers (WIP) feat(cdc): amortize snapshot read to multiple barriers Apr 22, 2024
@StrikeW StrikeW marked this pull request as ready for review April 22, 2024 03:10
@fuyufjh
Copy link
Member

fuyufjh commented Apr 22, 2024

Can you describe the background/motivation?

@StrikeW
Copy link
Contributor Author

StrikeW commented Apr 22, 2024

Can you describe the background/motivation?

To implement this RFC we discussed before.

@StrikeW StrikeW marked this pull request as draft April 25, 2024 01:07
@StrikeW StrikeW marked this pull request as ready for review April 25, 2024 07:57
Copy link
Contributor Author

@StrikeW StrikeW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hzxa21 @fuyufjh PTAL, will evaluate it these days.

@@ -69,6 +71,11 @@ pub struct CdcBackfillExecutor<S: StateStore> {
rate_limit_rps: Option<u32>,

disable_backfill: bool,

// TODO: make these options configurable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be done in #16426

@@ -98,6 +98,8 @@ impl ExecutorBuilder for StreamCdcScanExecutorBuilder {
state_table,
node.rate_limit,
disable_backfill,
1,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snapshot_interval will default to 1, and we allow user to config different value in WITH clause #16426

@StrikeW StrikeW requested a review from KeXiangWang April 26, 2024 03:32
Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM

@StrikeW
Copy link
Contributor Author

StrikeW commented Apr 26, 2024

Evaluated, the barrier doesn't pile up with interval = 5 barriers. Right image is the baseline (1.8.1-rc).

PR main

@StrikeW StrikeW added this pull request to the merge queue Apr 26, 2024
Merged via the queue into main with commit 6329101 Apr 26, 2024
27 of 28 checks passed
@StrikeW StrikeW deleted the siyuan/optimize-cdc-backfill-new branch April 26, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants